package com.fh.shop.api.mq.product;

import com.alibaba.fastjson.JSON;
import com.fh.shop.api.mq.config.MQConstant;
import com.fh.shop.api.mq.message.PayMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class PayProduct {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendPayMessage(PayMessage payMessage){
        String payJson = JSON.toJSONString(payMessage);
        rabbitTemplate.convertAndSend(MQConstant.Pay.EX,"",payJson);
    }

}
